import { devUrl } from '@/common/setting'

const getList = (size,current) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${devUrl}/medicinalPSS/supplier/queryAll`,
      method: 'POST',
      data: {
		  size,
		  current
	  },
      success: (res) => {
        resolve(res.data);
      },
      fail: (error) => {
        reject(error);
      }
    });
  });
};

/**
 *  @param  {orderNo:string}
 *  @param  {supplierId:string}
 *  @param  {createTime:string}
 *  @param  {num:number}
 *  @param  {money:number}
 *  @param  {audit:string}
 */
const addSupplier = (params) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${devUrl}/medicinalPSS/supplier/addSupplier`,
      method: 'POST',
      data: params,
      success: (res) => {
        resolve(res.data);
      },
      fail: (error) => {
        reject(error);
      }
    });
  });
};


/**
 * @param {supplierId:string}  
 */
const queryById = (params) => {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${devUrl}/medicinalPSS/supplier/queryById`,
      method: 'POST',
      data: params,
      success: (res) => {
        resolve(res.data);
      },
      fail: (error) => {
        reject(error);
      }
    });
  });
};
export { getList, addSupplier, queryById};
